package com.foreknow.oppExer1.exer2;

/**
 * @author shkstart
 * @create 2021-07-28 13:36
 */
public class ClassB implements InterfaceA {
    /**
     * 计算n的阶乘
     * @param n
     * @return
     */
    @Override
    public int method(int n) {
        if(n==1||n==0) return 1;//如果参数是0或者1返回1
        return n*method(n-1);//否则返回n和下次递归的积
    }
}
